cmake_minimum_required(VERSION 3.10)
project(johnsonli)

# set(CMAKE_VERBOSE_MAKEFILE ON)
# set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -rdynamic -O3 -fPIC -ggdb -std=c++11 -Wall")
# set(CMAKE_C_FLAGS "$ENV{CXXFLAGS} -rdynamic -O3 -fPIC -ggdb -std=c11 -Wall")

include_directories(./src)
include_directories(/usr/include)
include_directories(/usr/local/include)

link_directories(/usr/lib)
link_directories(/usr/local/lib)

set(LIB_SRC
    src/log.cpp
    src/config.cpp
    src/thread.cpp
    src/lock.cpp
    src/fiber.cpp
    src/schedule.cpp
    src/daemon.cpp  
    src/util.cpp
    src/iomanager.cpp
    src/timer.cpp
    src/hook.cpp
    src/fd_manager.cpp
    src/address.cpp
    src/socket.cpp
    src/bytearray.cpp
    src/byteendian.cpp
    src/tcp_server.cpp
    src/uri.rl.cpp
    src/env.cpp
    src/worker.cpp
    src/application.cpp
    src/module.cpp
    src/http/http.cpp
    src/http/http11_parser.rl.cpp
    src/http/httpclient_parser.rl.cpp
    src/http/http_parser.cpp
    src/http/http_server.cpp
    src/http/http_session.cpp
    src/http/http_connection.cpp
    src/http/servlet.cpp
    src/http/ws_session.cpp
    src/http/ws_servlet.cpp
    src/http/ws_server.cpp

    src/stream/stream.cpp
    src/stream/socket_stream.cpp
    src/stream/zlib_stream.cpp

    demo/my_module.cpp
    demo/protocol.cpp
    demo/chat_servlet.cpp

    src/util/hash_util.cpp
    src/util/json_util.cpp
)

set(LIBS
        pthread
        dl
        yaml-cpp 
        z
        crypto 
        jsoncpp
)



# add_executable(test_schedule "tests/test_schedule.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_schedule ${LIBS})

# add_executable(test_iomanager "tests/test_iomanager.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_iomanager ${LIBS})

# add_executable(test_fiber "tests/test_fiber.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_fiber ${LIBS})

# add_executable(test_hook "tests/test_hook.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_hook ${LIBS})

# add_executable(test_log "tests/test_log.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_log ${LIBS})

# add_executable(test_log2 "tests/test_log2.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_log2 ${LIBS})

# add_executable(test_addr "tests/test_addr.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_addr ${LIBS})

# add_executable(test_socket "tests/test_socket.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_socket ${LIBS})

# add_executable(test_byte "tests/test_byte.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_byte ${LIBS})

# add_executable(test "tests/test.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test ${LIBS})

# add_executable(test_http "tests/test_http.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_http ${LIBS})

# add_executable(test_httpparser "tests/test_httpparser.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_httpparser ${LIBS})

# add_executable(test_tcpserver "tests/test_tcpserver.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_tcpserver ${LIBS})

# add_executable(test_http_server "tests/test_http_server.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_http_server ${LIBS})

# add_executable(test_http_connection "tests/test_http_connection.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_http_connection ${LIBS})

# add_executable(test_daemon "tests/test_daemon.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_daemon ${LIBS})

# add_executable(test_env "tests/test_env.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_env ${LIBS})

# add_executable(test_app "tests/test_app.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(test_app ${LIBS})


# add_executable(echo_server "example/echo_server.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(echo_server ${LIBS})

# add_executable(my_http_server "example/my_http_server.cpp" ${LIB_SRC})
# TARGET_LINK_LIBRARIES(my_http_server ${LIBS})

add_executable(chat_room "demo/chat_room.cpp" ${LIB_SRC})
TARGET_LINK_LIBRARIES(chat_room ${LIBS})






